/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package stuff.ext;

import java.util.Arrays;
import java.util.Collection;
import stuff.Account;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.GrantedAuthorityImpl;
import org.springframework.security.core.userdetails.UserDetails;

/**
 *
 * @author Николай
 */
public class AccountDetsImpl implements UserDetails {

    Account acc;
    GrantedAuthority ga = new GrantedAuthorityImpl("ROLE_USER") ;

    public AccountDetsImpl(Account acc) {
        this.acc = acc;
    }

    public Account getAccount() {
        return acc;
    }

    @Override
    public Collection getAuthorities() {
        return Arrays.asList(ga);
    }

    @Override
    public String getPassword() {
        return acc.getPassword();
    }

    @Override
    public String getUsername() {
        return acc.getUserName();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
